﻿using Dapper.IService;
using Dapper.Model;
using Microsoft.Extensions.Configuration;
using MySql.Data.MySqlClient;
using System;
using System.Collections.Generic;
using System.Text;

namespace Dapper.Service
{
    public partial class OrderService:IOrderService
    {
        IConfiguration _configuration;
        MySqlConnection conn;
        public OrderService(IConfiguration configuration)
        {
            _configuration = configuration;
            var connectionString = _configuration.GetSection("ConnectionString").GetSection("mysqlServer").Value;
            conn = new MySqlConnection(connectionString);
        }

        public Order GetById(string id)
        {
            return conn.QuerySingle<Order>("select * from `Order` where id="+id);
        }
    }
}
